/*
 * @Author: szx
 * @Date: 2021-12-31 13:10:15
 * @LastEditTime: 2021-12-31 13:21:03
 * @Description:
 * @FilePath: \leetcode\400-499\455\455.js
 */
/**
 * @param {number[]} g
 * @param {number[]} s
 * @return {number}
 */
var findContentChildren = function (g, s) {
    g.sort((a, b) => a - b);
    s.sort((a, b) => a - b);
    let index = 0;
    for (let i = 0; i < s.length; i++) {
        if (index < g.length && g[index] <= s[i]) {
            index++;
        }
    }
    return index;
};
